package com.lingyun.ucm.client.heartheat.quartz;

import java.rmi.Naming;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.lingyun.ucm.common.bootstrap.Bootstrap;
import com.lingyun.ucm.common.rmi.IRMIServerService;
import com.lingyun.ucm.common.rmi.RMIUtil;
import com.lingyun.ucm.common.util.Constant;
/**
 * 
 * @author Terrence2013
 * 2018年1月24日 上午10:50:58
 * 客户端发起心跳向服务端发送自身状态
 */
public class ClientReportJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    	String rmiUrl = RMIUtil.getRMIURL(Bootstrap.inst().getCache().getServer(),Constant.SERVER_RMI_PORT, Constant.SERVER_RMI_SERVICE);
        try {
        	IRMIServerService serverReportService = (IRMIServerService) Naming.lookup(rmiUrl);
            serverReportService.receiveHearbeatFromClient(RMIUtil.getLocalIP());
        }catch(Exception ex) {
            //异常不处理
        }
    }

}
